import React from 'react';
import { ConfigProvider } from 'antd';
import { Route, Routes } from "react-router-dom";
import routers, { RouteType } from "../router";
import AuthRoute from "../router/AuthRouter";
import zhCN from 'antd/locale/zh_CN';
import "./App.scss"



const App = () => {
  const RouteAuthFun = (
    (routeList: RouteType[]) => {
      return routeList.map(
        (item: RouteType) => {
          return (
            <Route
              path={item.path}
              element={
                <AuthRoute auth={item.meta.auth} key={item.path}>
                  {item.element}
                </AuthRoute>
              }
              key={item.path}
            >
              {item?.children && RouteAuthFun(item.children)}
            </Route>
          );
        }
      );
    }
  );
  return (
    <ConfigProvider locale={zhCN} theme={{ token: { } }}>
      <Routes>{RouteAuthFun(routers)}</Routes>
    </ConfigProvider>
  );
};

export default App;












